package com.github.McPlugin.sql;

public enum SQLiteCommands {

    //签到
    CREATE_attendance(
            "CREATE TABLE IF NOT EXISTS `attendance` (" +
                    "`UUID` VARCHAR(255) NOT NULL ," +
                    "`TotalTime` INT(11) NULL DEFAULT NULL,"+
                    "`MonthRecord` VARCHAR(255) NULL DEFAULT NULL," +
                    "PRIMARY KEY (`UUID`))"
    ),
    DELETE_attendance(
            "DELETE FROM `attendance` WHERE `UUID` = ?"
    ),
    SELECT_attendance(
            "SELECT * FROM `attendance` WHERE `UUID` = ?"
    ),
    ADD_attendance(
            "INSERT INTO `attendance` " +
                    "(`UUID`,`TotalTime`,`MonthRecord`)" +
                    "VALUES (?,?,?)"
    ),
    UPDATE_attendance(
            "UPDATE `attendance`"+
                    "set `UUID`=?,`TotalTime`=?,`MonthRecord`=? WHERE `UUID` = ?"
    ),
    //商店商品
    CREATE_goods(
            "CREATE TABLE IF NOT EXISTS 'goods' (\n" +
                    "              ID int NOT NULL,\n" +
                    "              Name VARCHAR(255) NULL DEFAULT NULL,\n" +
                    "              Number INT NULL DEFAULT NULL,\n" +
                    "              Price INT NULL DEFAULT NULL,\n" +
                    "              Type VARCHAR(255) NULL DEFAULT NULL,\n" +
                    "              PRIMARY KEY ('ID')\n" +
                    "              )"
    ),
    ADD_goods(
            "INSERT INTO 'goods' \n" +
                    "                    ('ID','Name','Number','Price','Type')\n" +
                    "                    VALUES (?,?,?,?,?)"
    ),
    SELECT_goods(
            "SELECT * FROM goods"
    ),
    UPDATE_goods(
            "UPDATE `goods`"+
                    "set `Number`=? WHERE `ID` = ?"
    ),
    //销售记录
    CREATE_sell(
            "CREATE TABLE IF NOT EXISTS 'sell'(\n" +
                    "'ID' INT NOT NULL,\n" +
                    "'UUID' VARCHAR(255) NULL DEFAULT NULL,\n" +
                    "'Name' VARCHAR(255) Null DEFAULT NULL,\n" +
                    "'Number' INT NULL DEFAULT NULL,\n" +
                    "'Price' INT NULL DEFAULT NULL,\n" +
                    "'Time' DATETIME NULL DEFAULT NULL,\n" +
                    "PRIMARY KEY ('ID')\n" +
                    ")"
    ),
    ADD_sell(
            "INSERT INTO 'sell'\n" +
                    "('ID','UUID','Name','Number','Price','Time')\n" +
                    "VALUES(?,?,?,?,?, datetime('now','localtime'))"
    );

    private String command;
    SQLiteCommands(String command){
        this.command = command;
    }

    public String commandToString(){
        return command;
    }

}
